package com.daqian.chance.example.web.modules.member.controller;

import com.daqian.chance.common.base.BaseController;
import com.daqian.chance.core.rest.RestResult;
import com.daqian.chance.qiniu.oss.po.req.OssParamsRequest;
import com.daqian.chance.qiniu.oss.po.vo.OssParamsVO;
import com.daqian.chance.qiniu.oss.service.QiniuOssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: daqian
 * @Date: 2019/11/21 14:45
 */
@RestController
@RequestMapping("test/qiniu")
public class QiniuController extends BaseController {


    @Autowired
    private QiniuOssService qiniuOssService;

    /**
     * 生成七牛ossToken
     *
     * @param ossParamsRequest
     * @return com.daqian.chance.core.rest.RestResult<com.daqian.chance.qiniu.oss.po.vo.OssParamsVO>
     * @author daqian
     * @date 2019/11/26 22:45
     */
    @GetMapping("oss/token")
    public RestResult<OssParamsVO> generateQiniuOssToken(OssParamsRequest ossParamsRequest) {
        return RestResult.ok(qiniuOssService.generateQiniuOssToken(ossParamsRequest.getModule(), ossParamsRequest.getKey(), ossParamsRequest.getKeySuffix()));
    }

}
